home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / src / X11R4 / cmds / X / ddx / Xsun / sunCG2C.c.notused < prev    next >
Encoding:
Text File  |  1990-04-07  |  16.0 KB  |  583 lines

  1. /*-
  2.  * sunCG2C.c --
  3.  *    Functions to support the sun CG2 board as a memory frame buffer.
  4.  */
  5.  
  6. /************************************************************
  7. Copyright 1987 by Sun Microsystems, Inc. Mountain View, CA.
  8.  
  9.                     All Rights Reserved
  10.  
  11. Permission  to  use,  copy,  modify,  and  distribute   this
  12. software  and  its documentation for any purpose and without
  13. fee is hereby granted, provided that the above copyright no-
  14. tice  appear  in all copies and that both that copyright no-
  15. tice and this permission notice appear in  supporting  docu-
  16. mentation,  and  that the names of Sun or MIT not be used in
  17. advertising or publicity pertaining to distribution  of  the
  18. software  without specific prior written permission. Sun and
  19. M.I.T. make no representations about the suitability of this
  20. software for any purpose. It is provided "as is" without any
  21. express or implied warranty.
  22.  
  23. SUN DISCLAIMS ALL WARRANTIES WITH REGARD TO  THIS  SOFTWARE,
  24. INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT-
  25. NESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SUN BE  LI-
  26. ABLE  FOR  ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
  27. ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,  DATA  OR
  28. PROFITS,  WHETHER  IN  AN  ACTION OF CONTRACT, NEGLIGENCE OR
  29. OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION  WITH
  30. THE USE OR PERFORMANCE OF THIS SOFTWARE.
  31.  
  32. ********************************************************/
  33.  
  34. #ifndef    lint
  35. static char sccsid[] = "@(#)sunCG2C.c 2.8 87/06/05 Copyright 1987 Sun Micro";
  36. #endif
  37.  
  38. #include    "sun.h"
  39.  
  40. #ifndef    sprite
  41.  
  42. #include    <sys/mman.h>
  43. #include    <struct.h>
  44. #include    <pixrect/memreg.h>
  45. #include    <pixrect/cg2reg.h>
  46. #endif    sprite
  47.  
  48. #include    "colormap.h"
  49. #include    "colormapst.h"
  50. #include    "resource.h"
  51.  
  52. #ifdef    sprite
  53. Fb_Addr    fb_Addr;
  54. #else
  55.  
  56. extern Bool sunCG2MProbe();
  57. #ifndef _MAP_NEW
  58. extern caddr_t valloc();
  59. #else
  60. extern caddr_t mmap();
  61. #endif    _MAP_NEW
  62.  
  63. /*-
  64.  * The cg2 frame buffer is divided into several pieces.
  65.  *    1) a stack of 8 monochrome bitplanes
  66.  *    2) an array of 8-bit pixels
  67.  *    3) a union of these two where modifications are done via RasterOp
  68.  *        chips
  69.  *    4) various control registers
  70.  *    5) a shadow colormap.
  71.  *
  72.  * Each of these things is at a given offset from the base of the 4Mb devoted
  73.  * to each color board. In addition, the mmap() system call insists on the
  74.  * address and the length to be mapped being aligned on 8K boundaries.
  75.  * 
  76.  * XXX This could be made a lot cleaner with proper use of structs and 
  77.  * sizeof()'s.
  78.  */
  79.  
  80. struct cg2c_reg {
  81.     /*
  82.      * The status register is at 0x309000.  This isn't on an 8K
  83.      * boundary, so we have to put a 4K (0x1000) pad in front of it and
  84.      * map it here at 0x308000.
  85.      */
  86.     char csr_base[4096];
  87.     union {
  88.     struct cg2statusreg csr;
  89.     char csr_pad[4096];
  90.     } u_csr;
  91. };
  92.  
  93. struct cg2c_ppmask {
  94.     /* per-plane mask, offset = 0x30A000, size = 8K */
  95.     union {
  96.     unsigned short        ppmask;
  97.     char              ppm_pad[8192];
  98.     } u_ppmask;
  99. };
  100.  
  101. struct cg2c_cmap {
  102.     /* colormap, offset = 0x310000, size = 8K */
  103.     union {
  104.     struct {      /* Shouldn't these be u_char's??? */
  105.         u_short            redmap[256];    /* Red-component map */
  106.         u_short            greenmap[256];    /* Green-component map */
  107.         u_short            bluemap[256];    /* Blue-component map */
  108.     }                 cmap;
  109.     char              cmap_pad[8192];
  110.     } u_cmap;
  111. };
  112.  
  113. typedef struct cg2c {
  114.     union byteplane *image;        /* the 8-bit memory */
  115.     struct cg2c_reg *u_csr;        /* the status register */
  116.     struct cg2c_ppmask *u_ppmask;    /* The plane mask register */
  117.     struct cg2c_cmap *u_cmap;        /* the colormap */
  118. } CG2C, CG2CRec, *CG2CPtr;
  119.  
  120. #define CG2C_IMAGE(fb)        ((caddr_t)((fb).image))
  121. #define CG2C_IMAGEOFF        ((off_t)0x00100000)
  122. #define CG2C_IMAGELEN        (sizeof(union byteplane))
  123. #define CG2C_REG(fb)        ((caddr_t)((fb).u_csr))
  124. #define CG2C_REGOFF        ((off_t)0x00308000)
  125. #define CG2C_REGLEN        (0x2000)
  126. #define CG2C_MASK(fb)        ((caddr_t)((fb).u_ppmask))
  127. #define CG2C_MASKOFF        ((off_t)0x0030A000)
  128. #define CG2C_MASKLEN        (0x2000)
  129. #define CG2C_CMAP(fb)        ((caddr_t)((fb).u_cmap))
  130. #define CG2C_CMAPOFF        ((off_t)0x00310000)
  131. #define CG2C_CMAPLEN        (0x2000)
  132.  
  133. #endif    sprite
  134.  
  135. static int  sunCG2CScreenIndex;
  136.  
  137. extern int TellLostMap(), TellGainedMap();
  138.  
  139. static void
  140. sunCG2CUpdateColormap(fb, index, count, rmap, gmap,bmap)
  141.     CG2CPtr       fb;
  142.     int          index, count;
  143.     u_char      *rmap, *gmap, *bmap;
  144. {
  145. #ifdef SUN_WINDOWS
  146.     if (sunUseSunWindows()) {
  147.     static Pixwin *pw = 0;
  148.  
  149.     if (! pw) {
  150.         if ( ! (pw = pw_open(windowFd)) )
  151.         FatalError( "sunCG2CUpdateColormap: pw_open failed\n" );
  152.         pw_setcmsname(pw, "X.V11");
  153.     }
  154.     pw_putcolormap(
  155.         pw, index, count, &rmap[index], &gmap[index], &bmap[index]
  156.     );
  157.     }
  158. #endif SUN_WINDOWS
  159.  
  160. #ifdef    sprite
  161.     if(Fb_PUTCMAP(&sunCmap) != SUCCESS) {
  162.     perror("sunCG3CUpdateColormap");
  163.     FatalError( "sunCG4CUpdateColormap: FBIOPUTCMAP failed\n" );
  164.     }
  165. #else
  166.     fb->u_csr->u_csr.csr.update_cmap = 0;
  167.     while (count--) {
  168.     fb->u_cmap->u_cmap.cmap.redmap[index] = rmap[index];
  169.     fb->u_cmap->u_cmap.cmap.greenmap[index] = gmap[index];
  170.     fb->u_cmap->u_cmap.cmap.bluemap[index] = bmap[index];
  171.     index++;
  172.     }
  173.     fb->u_csr->u_csr.csr.update_cmap = 1;
  174. #endif
  175. }
  176.  
  177. /*-
  178.  *-----------------------------------------------------------------------
  179.  * sunCG2CSaveScreen --
  180.  *    Preserve the color screen by turning on or off the video
  181.  *
  182.  * Results:
  183.  *    None.
  184.  *
  185.  * Side Effects:
  186.  *    Video state is switched
  187.  *
  188.  *-----------------------------------------------------------------------
  189.  */
  190. static Bool
  191. sunCG2CSaveScreen (pScreen, on)
  192.     ScreenPtr      pScreen;
  193.     Bool          on;
  194. {
  195.     int        state = on;
  196.  
  197.     if (on != SCREEN_SAVER_ON) {
  198.     SetTimeSinceLastInputEvent();
  199.     state = 1;
  200.     } else {
  201.     state = 0;
  202.     }
  203. #ifdef    sprite
  204.     Fb_SVIDEO(state);
  205. #else
  206.     ((CG2CPtr)sunFbs[pScreen->myNum].fb)->u_csr->u_csr.csr.video_enab = state;
  207. #endif
  208.     return( TRUE );
  209. }
  210.  
  211. /*-
  212.  *-----------------------------------------------------------------------
  213.  * sunCG2CCloseScreen --
  214.  *    called to ensure video is enabled when server exits.
  215.  *
  216.  * Results:
  217.  *    Screen is unsaved.
  218.  *
  219.  * Side Effects:
  220.  *    None
  221.  *
  222.  *-----------------------------------------------------------------------
  223.  */
  224. /*ARGSUSED*/
  225. static Bool
  226. sunCG2CCloseScreen(i, pScreen)
  227.     int        i;
  228.     ScreenPtr    pScreen;
  229. {
  230.     Bool    ret;
  231.  
  232.     pScreen->CloseScreen = (Bool (*)()) pScreen->devPrivates[sunCG2CScreenIndex].ptr;
  233.     ret = (*pScreen->CloseScreen) (i, pScreen);
  234.     sunFbs[pScreen->myNum].fbPriv = NULL;
  235.     (void)(*pScreen->SaveScreen)(pScreen, SCREEN_SAVER_OFF);
  236.     return ret;
  237. }
  238.  
  239. /*-
  240.  *-----------------------------------------------------------------------
  241.  * sunCG2CInstallColormap --
  242.  *    Install given colormap.
  243.  *
  244.  * Results:
  245.  *    None
  246.  *
  247.  * Side Effects:
  248.  *    All clients requesting ColormapNotify are notified
  249.  *
  250.  *-----------------------------------------------------------------------
  251.  */
  252. static void
  253. sunCG2CInstallColormap(cmap)
  254.     ColormapPtr    cmap;
  255. {
  256.     register int i;
  257.     register Entry *pent;
  258.     register VisualPtr pVisual = cmap->pVisual;
  259.     u_char      rmap[256], gmap[256], bmap[256];
  260.     fbFd          *fb = &sunFbs[cmap->pScreen->myNum];
  261.  
  262.     if (cmap == (ColormapPtr)fb->fbPriv)
  263.     return;
  264.     if (fb->fbPriv)
  265.     WalkTree(cmap->pScreen, TellLostMap,
  266.          (pointer) &(((ColormapPtr)fb->fbPriv)->mid));
  267.     if ((pVisual->class | DynamicClass) == DirectColor) {
  268.     for (i = 0; i < 256; i++) {
  269.         pent = &cmap->red[(i & pVisual->redMask) >>
  270.                   pVisual->offsetRed];
  271.         rmap[i] = pent->co.local.red >> 8;
  272.         pent = &cmap->green[(i & pVisual->greenMask) >>
  273.                 pVisual->offsetGreen];
  274.         gmap[i] = pent->co.local.green >> 8;
  275.         pent = &cmap->blue[(i & pVisual->blueMask) >>
  276.                    pVisual->offsetBlue];
  277.         bmap[i] = pent->co.local.blue >> 8;
  278.     }
  279.     } else {
  280.     for (i = 0, pent = cmap->red;
  281.          i < pVisual->ColormapEntries;
  282.          i++, pent++) {
  283.         if (pent->fShared) {
  284.         rmap[i] = pent->co.shco.red->color >> 8;
  285.         gmap[i] = pent->co.shco.green->color >> 8;
  286.         bmap[i] = pent->co.shco.blue->color >> 8;
  287.         }
  288.         else {
  289.         rmap[i] = pent->co.local.red >> 8;
  290.         gmap[i] = pent->co.local.green >> 8;
  291.         bmap[i] = pent->co.local.blue >> 8;
  292.         }
  293.     }
  294.     }
  295.     fb->fbPriv = (pointer)cmap;
  296.     sunCG2CUpdateColormap((CG2CPtr)fb->fb, 0, 256, rmap, gmap, bmap);
  297.     WalkTree(cmap->pScreen, TellGainedMap, (pointer) &(cmap->mid));
  298. }
  299.  
  300. /*-
  301.  *-----------------------------------------------------------------------
  302.  * sunCG2CUninstallColormap --
  303.  *    Uninstall given colormap.
  304.  *
  305.  * Results:
  306.  *    None
  307.  *
  308.  * Side Effects:
  309.  *    All clients requesting ColormapNotify are notified
  310.  *
  311.  *-----------------------------------------------------------------------
  312.  */
  313. static void
  314. sunCG2CUninstallColormap(cmap)
  315.     ColormapPtr    cmap;
  316. {
  317.     if (cmap == (ColormapPtr)sunFbs[cmap->pScreen->myNum].fbPriv) {
  318.     Colormap defMapID = cmap->pScreen->defColormap;
  319.  
  320.     if (cmap->mid != defMapID) {
  321.         ColormapPtr defMap;
  322.  
  323.         defMap = (ColormapPtr) LookupIDByType(defMapID, RT_COLORMAP);
  324.         if (defMap)
  325.         (*cmap->pScreen->InstallColormap)(defMap);
  326.         else
  327.             ErrorF("sunCG2C: Can't find default colormap\n");
  328.     }
  329.     }
  330. }
  331.  
  332. /*-
  333.  *-----------------------------------------------------------------------
  334.  * sunCG2CListInstalledColormaps --
  335.  *    Fills in the list with the IDs of the installed maps
  336.  *
  337.  * Results:
  338.  *    Returns the number of IDs in the list
  339.  *
  340.  * Side Effects:
  341.  *    None
  342.  *
  343.  *-----------------------------------------------------------------------
  344.  */
  345. /*ARGSUSED*/
  346. static int
  347. sunCG2CListInstalledColormaps(pScreen, pCmapList)
  348.     ScreenPtr    pScreen;
  349.     Colormap    *pCmapList;
  350. {
  351.     *pCmapList = ((ColormapPtr)sunFbs[pScreen->myNum].fbPriv)->mid;
  352.     return (1);
  353. }
  354.  
  355.  
  356. /*-
  357.  *-----------------------------------------------------------------------
  358.  * sunCG2CStoreColors --
  359.  *    Sets the pixels in pdefs into the specified map.
  360.  *
  361.  * Results:
  362.  *    None
  363.  *
  364.  * Side Effects:
  365.  *    None
  366.  *
  367.  *-----------------------------------------------------------------------
  368.  */
  369. static void
  370. sunCG2CStoreColors(pmap, ndef, pdefs)
  371.     ColormapPtr    pmap;
  372.     int        ndef;
  373.     xColorItem    *pdefs;
  374. {
  375.     u_char    rmap[256], gmap[256], bmap[256];
  376.     register int i;
  377.     CG2CPtr fb;
  378.  
  379.     if (pmap != (ColormapPtr)sunFbs[pmap->pScreen->myNum].fbPriv)
  380.     return;
  381.     fb = (CG2CPtr)sunFbs[pmap->pScreen->myNum].fb;
  382.     while (ndef--) {
  383.     i = pdefs->pixel;
  384.     rmap[i] = pdefs->red >> 8;
  385.     gmap[i] = pdefs->green >> 8;
  386.     bmap[i] = pdefs->blue >> 8;
  387.     sunCG2CUpdateColormap(fb, i, 1, rmap, gmap, bmap);
  388.     pdefs++;
  389.     }
  390. }
  391.  
  392. /*-
  393.  *-----------------------------------------------------------------------
  394.  * sunCG2CInit --
  395.  *    Attempt to find and initialize a cg2 framebuffer used as mono
  396.  *
  397.  * Results:
  398.  *    TRUE if everything went ok. FALSE if not.
  399.  *
  400.  * Side Effects:
  401.  *    Most of the elements of the ScreenRec are filled in. Memory is
  402.  *    allocated for the frame buffer and the buffer is mapped. The
  403.  *    video is enabled for the frame buffer...
  404.  *
  405.  *-----------------------------------------------------------------------
  406.  */
  407. /*ARGSUSED*/
  408. static Bool
  409. sunCG2CInit (index, pScreen, argc, argv)
  410.     int              index;        /* The index of pScreen in the ScreenInfo */
  411.     ScreenPtr      pScreen;      /* The Screen to initialize */
  412.     int              argc;            /* The number of the Server's arguments. */
  413.     char          **argv;       /* The arguments themselves. Don't change! */
  414. {
  415.     if (!cfbScreenInit (pScreen,
  416. #ifndef sprite
  417.             (pointer)((CG2CPtr)sunFbs[index].fb)->image,
  418. #else
  419.             sunFbs[index].fb,
  420. #endif
  421.             sunFbs[index].info.fb_width,
  422.             sunFbs[index].info.fb_height,
  423.             monitorResolution, monitorResolution,
  424.             sunFbs[index].info.fb_width))
  425.     return (FALSE);
  426.  
  427.     pScreen->SaveScreen =               sunCG2CSaveScreen;
  428.     pScreen->devPrivates[sunCG2CScreenIndex].ptr = (pointer) pScreen->CloseScreen;
  429.     pScreen->CloseScreen = sunCG2CCloseScreen;
  430.  
  431. #ifndef STATIC_COLOR
  432.     pScreen->InstallColormap =             sunCG2CInstallColormap;
  433.     pScreen->UninstallColormap =        sunCG2CUninstallColormap;
  434.     pScreen->ListInstalledColormaps =     sunCG2CListInstalledColormaps;
  435.     pScreen->StoreColors =              sunCG2CStoreColors;
  436. #endif STATIC_COLOR
  437.  
  438.     sunCG2CSaveScreen( pScreen, SCREEN_SAVER_FORCER );
  439.     return (sunScreenInit(pScreen) && cfbCreateDefColormap(pScreen));
  440. }
  441.  
  442.  
  443. /*-
  444.  *-----------------------------------------------------------------------
  445.  * sunCG2CProbe --
  446.  *    Attempt to find and initialize a cg2 framebuffer used as mono
  447.  *
  448.  * Results:
  449.  *    TRUE if everything went ok. FALSE if not.
  450.  *
  451.  * Side Effects:
  452.  *    Memory is allocated for the frame buffer and the buffer is mapped.
  453.  *
  454.  *-----------------------------------------------------------------------
  455.  */
  456. Bool
  457. sunCG2CProbe (pScreenInfo, index, fbNum, argc, argv)
  458.     ScreenInfo      *pScreenInfo;    /* The screenInfo struct */
  459.     int              index;        /* The index of pScreen in the ScreenInfo */
  460.     int              fbNum;        /* Index into the sunFbData array */
  461.     int              argc;            /* The number of the Server's arguments. */
  462.     char          **argv;       /* The arguments themselves. Don't change! */
  463. {
  464.     int        i;
  465.     int         fd;
  466.     struct fbtype    fbType;
  467.     static CG2CRec      CG2Cfb;
  468.  
  469.     /*
  470.      * See if the user wants this board to be treated as a monochrome
  471.      * display.
  472.      */
  473.     for (i = 0; i < argc; i++) {
  474.     if (strcmp (argv[i], "-mono") == 0) {
  475.         return sunCG2MProbe (pScreenInfo, index, fbNum, argc, argv);
  476.     }
  477.     }
  478.  
  479. #ifdef    sprite
  480.     Fb_Type    fbt;
  481.  
  482.     if(Fb_GTYPE(&fbt) != SUCCESS) {
  483.         return FALSE;
  484.     }
  485.     if(fbt.fb_type != FBTYPE_SUN_CG2) {
  486.         return FALSE;
  487.     }
  488.     if(Fb_MAP(&fb_Addr) != SUCCESS) {
  489.         return FALSE;
  490.     }
  491.  
  492. #else
  493.     if ((fd = sunOpenFrameBuffer(FBTYPE_SUN2COLOR, &fbType,
  494.                  index, fbNum, argc, argv)) < 0)
  495.     return FALSE;
  496.  
  497. #ifdef    _MAP_NEW
  498.     if ((int)(CG2Cfb.image = (union byteplane *) mmap ((caddr_t) 0, CG2C_IMAGELEN, PROT_READ | PROT_WRITE,
  499.           MAP_SHARED | _MAP_NEW, fd, CG2C_IMAGEOFF)) == -1) {
  500.           Error ("Mapping cg2c.image");
  501.           goto bad;
  502.     }
  503.     if ((int)(CG2Cfb.u_csr = (struct cg2c_reg *) mmap ((caddr_t) 0, CG2C_REGLEN, PROT_READ | PROT_WRITE,
  504.           MAP_SHARED | _MAP_NEW, fd, CG2C_REGOFF)) == -1) {
  505.           Error ("Mapping cg2c.reg");
  506.           goto bad;
  507.     }
  508.     if ((int)(CG2Cfb.u_ppmask = (struct cg2c_ppmask *) mmap ((caddr_t) 0, CG2C_MASKLEN, PROT_READ | PROT_WRITE,
  509.           MAP_SHARED | _MAP_NEW, fd, CG2C_MASKOFF)) == -1) {
  510.           Error ("Mapping cg2c.reg");
  511.           goto bad;
  512.     }
  513.     if ((int)(CG2Cfb.u_cmap = (struct cg2c_cmap *) mmap ((caddr_t) 0, CG2C_CMAPLEN, PROT_READ | PROT_WRITE,
  514.           MAP_SHARED | _MAP_NEW, fd, CG2C_CMAPOFF)) != -1) {
  515.           goto ok;
  516.     }
  517.     Error ("Mapping cg2c.cmap");
  518. #else
  519.     CG2Cfb.image = (union byteplane *)valloc (CG2C_IMAGELEN + CG2C_REGLEN + CG2C_MASKLEN + CG2C_CMAPLEN);
  520.     CG2Cfb.u_csr = (struct cg2c_reg *) ((char *)CG2Cfb.image + CG2C_IMAGELEN);
  521.     CG2Cfb.u_ppmask = (struct cg2c_ppmask *) ((char *)CG2Cfb.u_csr + CG2C_REGLEN);
  522.     CG2Cfb.u_cmap = (struct cg2c_cmap *) ((char *)CG2Cfb.u_ppmask + CG2C_MASKLEN);
  523.     if (CG2Cfb.image == (union byteplane *) NULL) {
  524.     ErrorF ("Could not allocate room for frame buffer.\n");
  525.     return FALSE;
  526.     }
  527.  
  528.     if (mmap (CG2C_IMAGE(CG2Cfb), CG2C_IMAGELEN, PROT_READ | PROT_WRITE,
  529.           MAP_SHARED, fd, CG2C_IMAGEOFF) < 0) {
  530.           Error ("Mapping cg2c.image");
  531.           goto bad;
  532.     }
  533.     if (mmap (CG2C_REG(CG2Cfb), CG2C_REGLEN, PROT_READ | PROT_WRITE,
  534.           MAP_SHARED, fd, CG2C_REGOFF) < 0) {
  535.           Error ("Mapping cg2c.reg");
  536.           goto bad;
  537.     }
  538.     if (mmap (CG2C_MASK(CG2Cfb), CG2C_MASKLEN, PROT_READ | PROT_WRITE,
  539.           MAP_SHARED, fd, CG2C_MASKOFF) < 0) {
  540.           Error ("Mapping cg2c.reg");
  541.           goto bad;
  542.     }
  543.     if (mmap (CG2C_CMAP(CG2Cfb), CG2C_CMAPLEN, PROT_READ | PROT_WRITE,
  544.           MAP_SHARED, fd, CG2C_CMAPOFF) >= 0) {
  545.           goto ok;
  546.     }
  547.     Error ("Mapping cg2c.cmap");
  548. #endif    _MAP_NEW
  549. bad:
  550.     (void) close (fd);
  551.     return FALSE;
  552.  
  553. ok:
  554.     /*
  555.      * Enable all planes
  556.      */
  557.     CG2Cfb.u_ppmask->u_ppmask.ppmask = 0xFF;
  558. #endif    /* sprite */
  559.  
  560.     sunFbs[index].fd = fd;
  561.     sunFbs[index].info = fbType;
  562.     sunFbs[index].fb = (pointer) &CG2Cfb;
  563.     sunFbs[index].EnterLeave = NoopDDA;
  564.     sunSupportsDepth8 = TRUE;
  565.     return TRUE;
  566. }
  567.  
  568. /*ARGSUSED*/
  569. Bool
  570. sunCG2CCreate(pScreenInfo, argc, argv)
  571.     ScreenInfo      *pScreenInfo;
  572.     int              argc;
  573.     char          **argv;
  574. {
  575.     if (sunGeneration != serverGeneration)
  576.     {
  577.     sunCG2CScreenIndex = AllocateScreenPrivateIndex();
  578.     if (sunCG2CScreenIndex < 0)
  579.         return FALSE;
  580.     }
  581.     return (AddScreen(sunCG2CInit, argc, argv) >= 0);
  582. }
  583.